# coding=utf-8
# todo 二叉树及其遍历
class newnode(object):
    def __init__(self, data, left=0, right=0):
        self.data = data
        self.left = left
        self.right = right


class Btree(object):
    def pre(self, node):  # 前序遍历
        if node == 0:
            return
        print(node.data)
        self.pre(node.left)
        self.pre(node.right)

    def inorder(self, node):  # 中序遍历
        if node == 0:
            return
        self.inorder(node.left)
        print(node.data)
        self.inorder(node.right)

    def post(self, node):  # 后序遍历
        if node == 0:
            return
        self.post(node.left)
        self.post(node.right)
        print(node.data)
